home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir39
/
cdpath12.zip
/
READ.ME
< prev
Wrap
Text File
|
1993-08-07
|
8KB
|
198 lines
CDPATH.COM
KCD.COM
Version 1.2
Original version by ??
Modified by S. E. Kohn
Aug, 1993
Files in CDPATH12.ZIP:
READ.ME This file.
CDPATH.COM Program to generate CDPATH environmental variable.
CDPATH.C Source code for CDPATH.COM
KCD.COM Directory changer program
KCD.C Microsoft C 6.0 source code for CD.COM.
FILE_ID.DIZ Description file for BBS listings
INTRODUCTION
============
CDPATH.COM is a program to generate the CDPATH environmental variable
used by the 4DOS CD commmand. In addition, program KCD.COM is a replacement
for the internal 4DOS CD command that allows changing to directories with
only a partial name specified (i.e., directory name completion).
A directory change program (CD) should have a number of features:
1. The ability to find the target directory, even if it is part
of a different branch of the directory tree, without having
to specifying a detailed path. For example, to go from
directory "c:\samples\foo" to "c:\test\red\bar" by simply
entering "cd bar"
2. The ability to find a target directory on another drive.
3. Name completion. The ability to find a target directory with
only the first part of the name specified. For example,
specifying "cd exam" to go to directory "examples".
With the introduction of 4DOS 4.0, the environmental variable CDPATH
was introduced as a fast way to navigate the file directory tree. CDPATH
is a list of directories (in the same format as the standard PATH variable)
which are to be searched. The internal 4DOS CD command searches the
directories specified in CDPATH to see if the desired target directory is
either one of those, or a sub-directory of them. For example, if CDPATH
were set to
set CDPATH=c:\;c:\dos;c:\bin;c:\windows
then the command "CD FOO" would first search for "FOO" as a directory in
the CDPATH variable and then search for
c:\foo
c:\dos\foo
c:\bin\foo
c:\windows\foo
in that order. The search stops when the first directory match is found.
This is a fast and efficient way of finding a directory. It works well
across different drives, including floppies.
However, there are two limitations to this method. First, it lacks
directory name completion capability. Secondly, environmental variables,
including CDPATH, are limited to 255 characters (actually less, since the
255 limit includes the "SET CDPATH="). That is the limit for 4DOS. For
those too foolish to use 4DOS the limit is 127 characters.
I created the program CDPATH.COM to automatically generate the
environmental variable CDPATH needed for the 4DOS CD command. To allow
searching longer CDPATH's, program CDPATH.COM will generate environmental
variables CDPATH, CDPATH1, CDPATH2, etc. These can be used with the KCD.COM
program included.
There are a number of programs on the Shareware market that are fast
directory changers. The good ones (such as Kieth Ledbetter's LCD) have
the very desirable feature of directory name completion. Programs like LCD
use an index file to maintain a list of all files on disc. However, every
time a directory is added or deleted, the index file must be updated. This
method works well for hard discs, but not for floppies. Also, occasionally
automated software installation programs will have trouble because it creates
a new directory that LCD won't recognize. The internal 4DOS CD command is
not as sensitive, since it needs only the root directories to be specified
in CDPATH.
KCD
===
Recently, I downloaded from CI$ the source code for a change directory
program that works with the 4DOS environmental variable CDPATH. The original
program is a simple, efficient implementation of the internal 4DOS CD command.
By making a few small changes, I was able to add:
1. Directory name completion ability.
2. Sequential search of CDPATH, CDPATH1, CDPATH2, to allow an
unlimited number of directory roots to be searched.
3. A few error corrections in the original (LINT works wonders!).
The executable program was compiled with Microsoft C 6.0.
To use this program, or the internal 4DOS CD command, an environmental
variable called CDPATH must be created. The commands to generate CDPATH
will be created by the program CDPATH.COM described below. The SET commands
for the environmental variables CDPATH, CDPATH1, etc. are customarily placed
in the AUTOEXEC.BAT file. Then they will be created automatically each time
the computer is booted up.
Then create an alias for CD
alias cd `<path>\kcd.com`
The internal 4DOS CD command also has the option of flipping the current
directory with the last previous directory by specifying "CD -". To
add this feature with KCD.COM, it is necessary to set an environmental
variable, LASTDIR with the name of the previous directory. This
can be done with the following alias
alias cd `set l$$=%_cwd^<path>\kcd %1^set lastdir=l$$^unset l$$`
where "<path>" is the directory path containing program KCD.COM. My experience
is that this is a very fast and reliable directory changer. It has the
advantages of then internal 4DOS CD command plus directory name completion
and unlimited effective length of CDPATH. Compared to index file directory
changers such as LCD, it works better with floppies and installation software.
An additional alias for moving up the directory tree to use is
alias .*...... `cd .%0`
This will move up the directory chain the number of levels equal to the
number of '.'s entered, i.e. '...' will move up three levels in the
directory chain.
CDPATH
======
To generate the environmental variable CDPATH, I have written the
short program CDPATH. This will search through the specified drives to
find all directories that should be listed in CDPATH. To use this
program
CDPATH <file name> <drive letter> [<drive letter> ...]
This will write the command to generate CDPATH to the file specified by
<file name>. If more than 255 characters are needed, for CDPATH, the
program will automatically create CDPATH1, CDPATH2, etc. as needed.
For example, to search drives C D and E,
CDPATH test.bat C D E
This will write the command lines necessary to generate CDPATH to file
TEST.BAT. It is strongly recommended that you edit the SET CDPATH command in
the file test.bat to put most frequently accessed directories first, and to
delete unnecessary directories.
After you have edited the command line for CDPATH, add it to your
AUTOEXEC.BAT file.
Since the original source code was freeware, I consider my modifications
to KCD.C to also to be freeware. Program CDPATH.C is also released as
freeware. I make no warranties as to their accuracy and accept no
responsibility for any damage they may cause.
I would be interested in hearing opinions on this program. Leave mail at
CI$ for user 70031,1004. I would be very interested in hearing from the
original program author.
Stanley E. Kohn
Nov 15, 1992
Version History
===============
March 20, 1992 Version 1.0
Initial version.
Nov 11, 1992 Version 1.1.
CDPATH now orders directories alphabetically.
CD now properly handles 'cd ...' when more than two periods are
specified.